/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package ms.jasim.model.event.impl;

import ms.jasim.model.event.*;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.impl.EFactoryImpl;

import org.eclipse.emf.ecore.plugin.EcorePlugin;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class EventFactoryImpl extends EFactoryImpl implements EventFactory {
	/**
	 * Creates the default factory implementation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static EventFactory init() {
		try {
			EventFactory theEventFactory = (EventFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.example.org/jasim/events"); 
			if (theEventFactory != null) {
				return theEventFactory;
			}
		}
		catch (Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new EventFactoryImpl();
	}

	/**
	 * Creates an instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EventFactoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EObject create(EClass eClass) {
		switch (eClass.getClassifierID()) {
			case EventPackage.EVENT_MODEL: return createEventModel();
			case EventPackage.EVENT_SET: return createEventSet();
			case EventPackage.EVENT: return createEvent();
			case EventPackage.ABSOLUTE_TIME: return createAbsoluteTime();
			case EventPackage.EVENT_RELATIVE_TIME: return createEventRelativeTime();
			case EventPackage.ACTION_RELATIVE_TIME: return createActionRelativeTime();
			case EventPackage.SOLUTION_INCONSISTENT: return createSolutionInconsistent();
			case EventPackage.COMPOSITE_PRECONDITION: return createCompositePrecondition();
			case EventPackage.REACTION_LIST: return createReactionList();
			case EventPackage.MODIFY_MODEL_REACTION: return createModifyModelReaction();
			case EventPackage.MODIFY_OBJECT_REACTION: return createModifyObjectReaction();
			case EventPackage.REPLAN_REACTION: return createReplanReaction();
			case EventPackage.FOR_ALL_REACTION: return createForAllReaction();
			case EventPackage.FOR_ALL_GOAL_DOMAIN: return createForAllGoalDomain();
			case EventPackage.CUSTOM_REACTION: return createCustomReaction();
			default:
				throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object createFromString(EDataType eDataType, String initialValue) {
		switch (eDataType.getClassifierID()) {
			case EventPackage.COMPOSITE_TYPE:
				return createCompositeTypeFromString(eDataType, initialValue);
			case EventPackage.GOAL_SOURCE:
				return createGoalSourceFromString(eDataType, initialValue);
			case EventPackage.ACTION_TYPE:
				return createActionTypeFromString(eDataType, initialValue);
			case EventPackage.MODIFICATION_TYPE:
				return createModificationTypeFromString(eDataType, initialValue);
			case EventPackage.MODIFIABLE_PREDICATE:
				return createModifiablePredicateFromString(eDataType, initialValue);
			case EventPackage.PROPERTY_MODIFICATION_TYPE:
				return createPropertyModificationTypeFromString(eDataType, initialValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String convertToString(EDataType eDataType, Object instanceValue) {
		switch (eDataType.getClassifierID()) {
			case EventPackage.COMPOSITE_TYPE:
				return convertCompositeTypeToString(eDataType, instanceValue);
			case EventPackage.GOAL_SOURCE:
				return convertGoalSourceToString(eDataType, instanceValue);
			case EventPackage.ACTION_TYPE:
				return convertActionTypeToString(eDataType, instanceValue);
			case EventPackage.MODIFICATION_TYPE:
				return convertModificationTypeToString(eDataType, instanceValue);
			case EventPackage.MODIFIABLE_PREDICATE:
				return convertModifiablePredicateToString(eDataType, instanceValue);
			case EventPackage.PROPERTY_MODIFICATION_TYPE:
				return convertPropertyModificationTypeToString(eDataType, instanceValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EventModel createEventModel() {
		EventModelImpl eventModel = new EventModelImpl();
		return eventModel;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EventSet createEventSet() {
		EventSetImpl eventSet = new EventSetImpl();
		return eventSet;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Event createEvent() {
		EventImpl event = new EventImpl();
		return event;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AbsoluteTime createAbsoluteTime() {
		AbsoluteTimeImpl absoluteTime = new AbsoluteTimeImpl();
		return absoluteTime;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EventRelativeTime createEventRelativeTime() {
		EventRelativeTimeImpl eventRelativeTime = new EventRelativeTimeImpl();
		return eventRelativeTime;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActionRelativeTime createActionRelativeTime() {
		ActionRelativeTimeImpl actionRelativeTime = new ActionRelativeTimeImpl();
		return actionRelativeTime;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public SolutionInconsistent createSolutionInconsistent() {
		SolutionInconsistentImpl solutionInconsistent = new SolutionInconsistentImpl();
		return solutionInconsistent;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CompositePrecondition createCompositePrecondition() {
		CompositePreconditionImpl compositePrecondition = new CompositePreconditionImpl();
		return compositePrecondition;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ReactionList createReactionList() {
		ReactionListImpl reactionList = new ReactionListImpl();
		return reactionList;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ModifyModelReaction createModifyModelReaction() {
		ModifyModelReactionImpl modifyModelReaction = new ModifyModelReactionImpl();
		return modifyModelReaction;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ModifyObjectReaction createModifyObjectReaction() {
		ModifyObjectReactionImpl modifyObjectReaction = new ModifyObjectReactionImpl();
		return modifyObjectReaction;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ReplanReaction createReplanReaction() {
		ReplanReactionImpl replanReaction = new ReplanReactionImpl();
		return replanReaction;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ForAllReaction createForAllReaction() {
		ForAllReactionImpl forAllReaction = new ForAllReactionImpl();
		return forAllReaction;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ForAllGoalDomain createForAllGoalDomain() {
		ForAllGoalDomainImpl forAllGoalDomain = new ForAllGoalDomainImpl();
		return forAllGoalDomain;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CustomReaction createCustomReaction() {
		CustomReactionImpl customReaction = new CustomReactionImpl();
		return customReaction;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CompositeType createCompositeTypeFromString(EDataType eDataType, String initialValue) {
		CompositeType result = CompositeType.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertCompositeTypeToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public GoalSource createGoalSourceFromString(EDataType eDataType, String initialValue) {
		GoalSource result = GoalSource.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertGoalSourceToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActionType createActionTypeFromString(EDataType eDataType, String initialValue) {
		ActionType result = ActionType.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertActionTypeToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ModificationType createModificationTypeFromString(EDataType eDataType, String initialValue) {
		ModificationType result = ModificationType.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertModificationTypeToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ModifiablePredicate createModifiablePredicateFromString(EDataType eDataType, String initialValue) {
		ModifiablePredicate result = ModifiablePredicate.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertModifiablePredicateToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PropertyModificationType createPropertyModificationTypeFromString(EDataType eDataType, String initialValue) {
		PropertyModificationType result = PropertyModificationType.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertPropertyModificationTypeToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EventPackage getEventPackage() {
		return (EventPackage)getEPackage();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @deprecated
	 * @generated
	 */
	@Deprecated
	public static EventPackage getPackage() {
		return EventPackage.eINSTANCE;
	}

} //EventFactoryImpl
